package com.seecoder.BlueWhale.repository;

import com.seecoder.BlueWhale.po.CouponGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CouponGroupRepository extends JpaRepository<CouponGroup, Integer> {
    List<CouponGroup> findAllByStoreId(int storeId);

    CouponGroup findById(int id);

    @Query("SELECT o FROM CouponGroup o WHERE o.id = (SELECT MAX(o2.id) FROM CouponGroup o2)")
    CouponGroup findWithMaxId();
}